<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<input type="text" id="txt">
<script>
    var data = {

    }
    Object.defineProperty(data,'txt',{
        set:function(v){
            txt.value = v;
            this._txt = v;
        },
        get:function(){
            return this._txt;
        }
    })

    var txt = document.getElementById('txt');
    data.txt = '你工好'
    txt.oninput = function(e){
        data.txt = e.target.value;
    }



</script>
</body>
</html>